home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 315 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.0 KB

  1. Path: fido.asd.sgi.com!austern
  2. From: jbuck@Synopsys.COM (Joe Buck)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: auto_ptr again
  5. Date: 07 Feb 1996 15:00:06 PST
  6. Organization: Synopsys Inc., Mountain View, CA 94043-4033
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4fbapm$lbk@hermes.synopsys.com>
  9. References: <4ebhn5$lgt@bmtlh10.bnr.ca> <4eucnc$hr9@hermes.synopsys.com> <9602051159.AA19131@lts.sel.alcatel.de>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 7 Feb 1996 22:57:58 GMT
  12. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  13.     iQBVAwUBMRkvJEy4NqrwXLNJAQHSLgH/VWlR4cVeBTyT/S20MdNIJ1FPm0Re/go1
  14.     rcHd5IUykJEpcil1IB/JKPGr9xvXrDITnsBEG/Gfh8urHA1JEENPDw==
  15.     =rnBV
  16. Originator: austern@isolde.mti.sgi.com
  17.  
  18. I wrote:
  19. >|> Anyone who writes a class in which X(X&) or X(const X&) does not have the
  20. >|> semantics of a copy operation is doing something wrong (e.g. auto_ptr in
  21. >|> the draft standard is broken).
  22.  
  23. James Kanze US/ESC 60/3/141 #40763 <kanze@lts.sel.alcatel.de> writes:
  24. >I wouldn't go quite that far.  X(X&) is a particular form of copy,
  25. >which modifies the copied object.  If it is programmed in such a way
  26. >that the number of intermittent copies is meaningless (as is the case
  27. >in auto_ptr), then it is perfectly valid.
  28.  
  29. You're not really disagreeing with me, James.  X(X&) is a reasonable
  30. thing to do in some cases, and the source object will then be modified,
  31. but if this operation does not look like a copy that leaves the
  32. functioning of the argument object mostly unaltered, the user of the class
  33. is going to have problems and surprises.  Many uses of X(X&) just modify
  34. private members to keep some sort of internal record, e.g. how many copies
  35. there are and connections between them.
  36.  
  37.  
  38. -- 
  39. -- Joe Buck     <jbuck@synopsys.com>    (not speaking for Synopsys, Inc)
  40.  
  41. Work for something because it is good,
  42. not just because it stands a chance to succeed.       -- Vaclav Havel
  43. ---
  44. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  45.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  46.   in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  47.